/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jse;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *
 * @author WangShuai
 */
public class RegexBackRef {

    public static void main(String[] args) {
        Pattern p = Pattern.compile("@[\\w]++");
        Matcher m = p.matcher("@aa @bb");
        //Dollar signs may be treated as references to captured subsequences as described above, 
        //and backslashes are used to escape literal characters in the replacement string. 
        System.out.println(m.replaceAll("$0" ));
    }
}
